//7-1 Battery Charge

import java.util.*;
public class Main {
	static int x[]=new int[24];
	public static void main(String[] args){
	         Scanner scan = new Scanner(System.in);
	         int i,s,c,n;
	         for(i=0;i<24;i++)
	        	 x[i]=scan.nextInt();
	         System.out.println(BatteryCharger.getChargeCost(scan.nextInt(),scan.nextInt()));
	         System.out.println(BatteryCharger.getChargeStartTime(scan.nextInt()));

	}
	static class BatteryCharger{
		public static int getChargeCost(int startHour, int chargeTime){
			int i,sum=0,n=0;
			for(i=0;i<chargeTime;i++){
                n=(startHour+i)%24;
				sum+=x[n];
            }
			return sum;
		}
		public static int getChargeStartTime(int chargeTime){
			int n=0,sum=999999,t,i;
			for(i=0;i<24;i++) {
				t=getChargeCost(i,chargeTime);
				if(sum>t) {
					sum=t;
					n=i;
				}
			}
			return n;
		}
	}
}
